<%

Dim ID	

Dim Rent_Title		
Dim City_Area		
Dim Price_Type		
Dim Room_Type		
Dim Room_Type2		
Dim Rent_Type		
Dim Room_Area		
Dim Room_ZX			
Dim Room_Floor		
Dim Rent_Price		
Dim Room_Pic		
Dim Room_Addrsss	
Dim Room_Addrsss_S	
Dim Room_Link		
Dim Room_Tel		


Dim Room_Pay		
Dim Room_Rent_Date	
Dim Room_Rent_YJ	
Dim Room_Build_Year

Dim Info_Type
Dim Update_Name
Dim Update_Date

Dim Action
Dim Info_ID
Dim Price_Type_V,Price_Type_T
Price_Type_V="1,2,3,4,5,6,7,8,9"
Price_Type_T="¥500以下,¥500～¥800,¥800～¥1000,¥1000～¥1200,¥1200～¥1500,¥1500～¥2000,¥2000～¥3000,¥3000～¥5000,¥5000以上,面议"
Sub Get_Rent_Info_Data()


	City_ID = reform("City_ID")
	Call Check_IsNumeric_Msg(City_ID,"选择地区")

	City_Area = reform("Corp_City_Area")
	Call Check_IsNumeric_Msg(City_Area,"选择地区")
	
	Rent_Title	= Reform("Rent_Title")		
	Price_Type	= Reform("Price_Type")		
	Room_Type	= Reform("Room_Type")		
	Room_Type2	= Reform("Room_Type2")		
	Rent_Type	= Reform("Rent_Type")		
	Room_Area	= Reform("Room_Area")		
	Room_ZX		= Reform("Room_ZX")			
	Room_Floor	= Reform("Room_Floor")		
	Rent_Price	= Reform("Rent_Price")		
	Room_Pic	= Reform("Room_Pic")		
	Room_Addrsss= Reform("Room_Addrsss")	
	Room_Addrsss_S = Reform("Room_Addrsss_S")	
	Room_Link	   = Reform("Room_Link")		
	Room_Tel	   = Reform("Room_Tel")		


	Room_Pay	   = Reform("Room_Pay")			
	Room_Rent_Date = Reform("Room_Rent_Date")			
	Room_Rent_YJ   = Reform("Room_Rent_YJ")			
	Room_Build_Year= Reform("Room_Build_Year")		
	Info_Type	   = Reform("Info_Type")		

	Update_Name		= Session("Admin_UserName")
	Update_Date		= now()
	
End Sub 
Sub Rent_Info_Action()
	Info_ID = Get_ID("Info_ID")
	If Info_ID=0 Then 
		Call Rent_Info_Add()
	Else
		Call Rent_Info_Edit()
	End If 
End Sub 
Sub Rent_Info_Add()	
	

	Call Get_Rent_Info_Data()

	sql = "INSERT INTO Rent_Info( " &_
		" Rent_Title"&_		
		",City_Area"&_		
		",Price_Type"&_		
		",Room_Type"&_		
		",Room_Type2"&_		
		",Rent_Type"&_		
		",Room_Area"&_		
		",Room_ZX"&_			
		",Room_Floor"&_		
		",Rent_Price"&_		
		",Room_Pic"&_		
		",Room_Addrsss"&_	
		",Room_Addrsss_S"&_	
		",Room_Link"&_		
		",Room_Tel"&_	
		
		",Room_Pay"&_	
		",Room_Rent_Date"&_	
		",Room_Rent_YJ"&_		
		",Room_Build_Year"&_		
		",Info_Type"&_		

		",Update_Name"&_
		",Update_Date"&_

		") VALUES( " &_
		" '"&Rent_Title&"'"&_		
		","&City_Area&_		
		",'"&Price_Type&"'"&_		
		",'"&Room_Type&"'"&_		
		",'"&Room_Type2&"'"&_		
		",'"&Rent_Type&"'"&_		
		",'"&Room_Area&"'"&_		
		",'"&Room_ZX&"'"&_			
		",'"&Room_Floor&"'"&_		
		",'"&Rent_Price&"'"&_		
		",'"&Room_Pic&"'"&_		
		",'"&Room_Addrsss&"'"&_	
		",'"&Room_Addrsss_S&"'"&_	
		",'"&Room_Link&"'"&_		
		",'"&Room_Tel&"'"&_	
		
		",'"&Room_Pay&"'"&_	
		",'"&Room_Rent_Date&"'"&_	
		",'"&Room_Rent_YJ&"'"&_		
		",'"&Room_Build_Year&"'"&_		

		",'"&Info_Type&"'"&_		

		",'"&Update_Name&"'"&_
		",'"&Update_Date&"'"&_
		")"
	writebr sql

    conn.execute(sql)

	AlertBox "增加成功！","Rent_Info_Query.asp"


End Sub

Sub Rent_Info_Edit()	


	Call Get_Rent_Info_Data()
	Info_ID = Reform("Info_ID")
	Call Check_IsNumeric(Info_ID)

	sql = "UPDATE Rent_Info Set " &_
		" Rent_Title='"&Rent_Title&"'"&_		
		",City_Area="&City_Area&_		
		",Price_Type="&Price_Type&_		
		",Room_Type='"&Room_Type&"'"&_		
		",Room_Type2='"&Room_Type2&"'"&_		
		",Rent_Type='"&Rent_Type&"'"&_		
		",Room_Area='"&Room_Area&"'"&_		
		",Room_ZX='"&Room_ZX&"'"&_			
		",Room_Floor='"&Room_Floor&"'"&_		
		",Rent_Price='"&Rent_Price&"'"&_		
		",Room_Pic='"&Room_Pic&"'"&_		
		",Room_Addrsss='"&Room_Addrsss&"'"&_	
		",Room_Addrsss_S='"&Room_Addrsss_S&"'"&_	
		",Room_Link='"&Room_Link&"'"&_		
		",Room_Tel='"&Room_Tel&"'"&_
		
		",Room_Pay='"&Room_Pay&"'"&_	
		",Room_Rent_Date='"&Room_Rent_Date&"'"&_	
		",Room_Rent_YJ='"&Room_Rent_YJ&"'"&_		
		",Room_Build_Year='"&Room_Build_Year&"'"&_		
		",Info_Type='"&Info_Type&"'"&_		

		",Update_Name ='"&Update_Name&"'"&_
		",Update_Date ='"&Update_Date&"'"&_

		  " WHERE ID = "&Info_ID

    conn.execute(sql)

	AlertBox "修改成功！","Rent_Info_Query.asp"

End Sub

Sub Rent_Info_Del()

	Info_ID = Reform("OP_ID")

	sql = "DELETE FROM  Rent_Info WHERE ID IN ( "&Info_ID &")"

    conn.execute(sql)

	AlertBox "删除成功！","Rent_Info_Query.asp"
	
End Sub

Sub Get_Rent_Info(ID)

	Info_ID = Get_ID(ID)
	If Info_ID=0 Then 
		Action = "增加"
		Exit Sub 
	End If 

	Sql = "SELECT * FROM Rent_Info WHERE ID="&Info_ID


	Set rs = conn.execute(sql)
	
	If Not rs.eof Then
		Rent_Title = rs("Rent_Title")		
		City_Area = rs("City_Area")		
		Price_Type = rs("Price_Type")		
		Room_Type = rs("Room_Type")		
		Room_Type2 = rs("Room_Type2")		
		Rent_Type = rs("Rent_Type")		
		Room_Area = rs("Room_Area")		
		Room_ZX = rs("Room_ZX")			
		Room_Floor = rs("Room_Floor")		
		Rent_Price = rs("Rent_Price")		
		Room_Pic = rs("Room_Pic")		
		Room_Addrsss = rs("Room_Addrsss")	
		Room_Addrsss_S = rs("Room_Addrsss_S")	
		Room_Link = rs("Room_Link")		
		Room_Tel = rs("Room_Tel")	
		
		Room_Pay = rs("Room_Pay")	
		Room_Rent_Date = rs("Room_Rent_Date")	
		Room_Rent_YJ = rs("Room_Rent_YJ")		
		Room_Build_Year = rs("Room_Build_Year")	
		Info_Type = rs("Info_Type")	
		
					   
		Update_Name    = rs("Update_Name")
		Update_Date    = rs("Update_Date")

	End If
	City_ID = Get_FirstValue("SELECT Parent_ID FROM City_Area WHERE ID="&City_Area)

	Action="修改"
End Sub 
Function Get_ID(Info_ID)
	If Request.ServerVariables ("Request_Method")="POST" Then
		ID = reform(Info_ID)
	Else
		ID = requery(Info_ID)
	End If 
	If IsNumeric(ID)=False Then 
		Get_ID = 0
	Else
		Get_ID = ID
	End If 
End Function 
%>


